package com.zixuan.sina.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@TableName("comment")
public class Comment {
    @TableId(value = "comment_id", type = IdType.ASSIGN_ID)
    private String commentId;
    private String postId;
    private String userId;
    private String resId;
    private String content;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date commentDate;
    /**
     * 上级评论id 根据它来生成评论树
     */
    private String parentId;
    @TableField(exist = false)
    private List<Comment> children;

}
